@using ZKEACMS.Product.Models
@model List<ProductCategoryTag>

<div class="tag-selector">
    @if (Model != null)
    {
        foreach (var item in Model.Where(m => m.ParentId == 0).OrderBy(m => m.ID))
        {
            <div class="panel panel-default">
                @Html.HiddenFor(m => Model[Model.IndexOf(item)].ID)
                @Html.HiddenFor(m => Model[Model.IndexOf(item)].ProductCategoryId)
                @Html.HiddenFor(m => Model[Model.IndexOf(item)].ParentId)
                <div class="panel-heading">@item.Title</div>
                <div class="panel-body">
                    @foreach (var child in Model.Where(m => m.ParentId == item.ID).OrderBy(m => m.ID))
                    {
                        <label class="checkbox-inline">
                            @Html.HiddenFor(m => Model[Model.IndexOf(child)].ID)
                            @Html.HiddenFor(m => Model[Model.IndexOf(child)].ProductCategoryId)
                            @Html.HiddenFor(m => Model[Model.IndexOf(child)].ParentId)
                            @Html.CheckBoxFor(m => Model[Model.IndexOf(child)].Selected)
                            @child.Title
                        </label>
                    }
                </div>
            </div>

        }
    }
</div>

<div style="padding-top: 7px;">
    <a target="_blank" href="@Url.Action("Index","ProductCategoryTag")">@L("Edit")</a>
    <a href="javascript:" class="reload-tag">@L("Refresh")</a>
</div>